<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>用户管理</title>
</head>
<body>
<div class="layui-form" lay-filter="regionSearchForm">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label" style="width:120px;">所属办事处\部门</label>
            <div class="layui-input-inline">
                <input type="text" name="dept" placeholder="请输入办事处\部门名称"
                       autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-inline">
            <button class="layui-btn layuiadmin-btn-list" lay-submit=""
                    lay-filter="region-search">
                <i class="layui-icon layui-icon-search"></i>
            </button>
        </div>
    </div>
</div>
<table class="layui-hide" id="regionTable" lay-filter="regionTable"></table>
<script type="text/javascript">
    var index;
    var form = layui.form;
    var regionSearchForm = form.render(null,'regionSearchForm');
    window.regionTable = layui.table;
    var regionTableNs = window.regionTable.render({
        elem : '#regionTable',
        url : window.basePath + '/sys/findRegionByPage',
				headers: {"token" : window.token},
				method: "post",
        height : 'full-250',
        cols : [ [  {
            type:'checkbox'
        },{
            field : 'regionName',
            width : 270,
            align : 'center',
            title : '办事处/部门'
        }, {
            field : 'manager',
            width : 200,
            align : 'center',
            title : '部门主管'
        },{
            field : 'workNo',
            width : 200,
            align : 'center',
            title : '工号'
        } ] ],
        text : {
            none : '暂无相关数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
        },
        page : true
    });

    window.regionTable.on('tool(regionTable)', function(obj) {
        var data = obj.data; //获得当前行数据
        var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
        var tr = obj.tr; //获得当前行 tr 的DOM对象
    });


    regionSearchForm.on('submit(region-search)',function(data){
        regionTableNs.reload({
            where :{
                regionName:data.field.dept
            },
            page:{
            	curr:1
            }
        });
        return false;
    });
</script>

<script type="text/html" id="workTypeTpl">
    {{#  if(d.emType === 0){ }}
    <span style="color: #329706;">内部员工</span>
    {{# }else { }}
    <span style="color: #3383f6;">合作用户</span>
    {{# } }}
</script>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
</body>
</html>